package com.sx.pipeline.ui.needs.construction.viewquote

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.sx.pipeline.R
import com.sx.pipeline.repos.http.res.NeedsQuotedVO
import com.sx.pipeline.utils.AndroidUtil

/**
 * @Author：YY
 * @Date：2022/2/10
 * @Describe: 查看报价适配器
 */
class ViewQuoteAdapter(
) : BaseQuickAdapter<NeedsQuotedVO, BaseViewHolder>(
    R.layout.item_view_quote,
) {
    override fun convert(holder: BaseViewHolder, item: NeedsQuotedVO) {
        holder.setText(R.id.tv_title,"报价"+(holder.position+1))
        holder.setText(R.id.tv_price,"单价:${item.price.toString()}")
        holder.setText(R.id.tv_total_price,"总价:${item.totalPrice.toString()}")
        holder.setText(R.id.tv_time,"供货时间：${item.startTime}-${item.endEnd}")
        holder.setText(R.id.tv_name,"联系人：${item.contact}   联系方式：${item.contactPhone}")
        holder.getView<TextView>(R.id.tv_call).setOnClickListener {
            //拨打电话
            AndroidUtil.toCallPhone(item.contactPhone,context)
        }
    }
}